home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / fredfish / 1092.lha / Programs / ErrorMsg / Include / libraries / errormsg.h < prev    next >
C/C++ Source or Header  |  1994-12-22  |  10KB  |  270 lines

  1. #ifndef    LIBRARIES_ERRORMSG_H
  2. #define    LIBRARIES_ERRORMSG_H
  3. /*
  4. **    $Filename: libraries/errormsg.h $
  5. **    $Revision: 4.01 $
  6. **
  7. **    errormsg.library definitions
  8. **
  9. **    (C) Copyright 1994 Frédéric Delacroix
  10. **    All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef    EXEC_LISTS_H
  18. #include <exec/lists.h>
  19. #endif
  20.  
  21. #ifndef    EXEC_LIBRARIES_H
  22. #include <exec/libraries.h>
  23. #endif
  24.  
  25. #ifndef    EXEC_SEMAPHORES_H
  26. #include <exec/semaphores.h>
  27. #endif
  28.  
  29. #ifndef UTILITY_TAGITEM_H
  30. #include <utility/tagitem.h>
  31. #endif
  32.  
  33. struct ErrorMsgBase {
  34.    struct Library LibNode;
  35.    ULONG emb_SegList;    /* pointer to seglist (PRIVATE) */
  36.  
  37. /* These remain valid as long as errormsg.library is open, they are readable
  38.    by your application... */
  39.    APTR emb_DOSBase;    /* pointer to DOSBase */
  40.    APTR emb_IntuitionBase;    /* pointer to IntuitionBase */
  41.    APTR emb_LocaleBase;    /* pointer to LocaleBase */
  42.    APTR emb_UtilityBase;    /* pointer to UtilityBase */
  43.    APTR emb_RexxSysLibBase;    /* pointer to RexxSysLibBase (or NULL if it */
  44.                    /* couldn't be opened), new for V2.0 */
  45.    APTR emb_ExecBase;    /* pointer to ExecBase , new for V3.02 */
  46.  
  47. /* This is private (subject to changes): */
  48.    APTR emb_Locale;
  49.    APTR emb_Catalog;
  50.    struct SignalSemaphore emb_FaultSemaphore;
  51.    struct MinList emb_FaultCache;
  52.    UBYTE FaultBuffer[100];
  53. };
  54.  
  55. /************************************************************************
  56. * System ID values                            *
  57. *************************************************************************
  58. These IDs are to be passed as the "System" argument: */
  59.  
  60. #define ERMSYS_INVALID    -1L    /* internal use */
  61. #define ERMSYS_DOS    0L    /* messages from dos.library */
  62. #define ERMSYS_EXEC    1L    /* messages from exec.library */
  63. #define ERMSYS_GRAPHICS    2L    /* messages from graphics.library */
  64. #define ERMSYS_INTUITION    3L    /* messages from intuition.library */
  65. #define ERMSYS_IFFPARSE    4L    /* messages from iffparse.library */
  66.  
  67. #define ERMSYS_AUDIO    5L    /* messages from audio.device */
  68. #define ERMSYS_GAMEPORT    6L    /* messages from gameport.device */
  69. #define ERMSYS_NARRATOR    7L    /* messages from narrator.device */
  70. #define ERMSYS_PARALLEL    8L    /* messages from parallel.device */
  71. #define ERMSYS_PRINTER    9L    /* messages from printer.device */
  72. #define ERMSYS_SCSIDISK    10L    /* messages from scsidisk.device */
  73. #define ERMSYS_SERIAL    11L    /* messages from serial.device */
  74. #define ERMSYS_TRACKDISK    12L    /* messages from trackdisk.device */
  75. #define ERMSYS_CLIPBOARD    13L    /* etc... */
  76. #define ERMSYS_CONSOLE    14L
  77. #define ERMSYS_INPUT    15L
  78. #define ERMSYS_KEYBOARD    16L
  79. #define ERMSYS_TIMER    17L
  80.  
  81. #define    ERMSYS_AMIGAGUIDE    18L
  82. #define    ERMSYS_ARP    19L
  83. #define    ERMSYS_COMMODITIES    20L
  84. #define    ERMSYS_ERRORMSG    21L    /* yes, we can diagnostic our own errors */
  85. #define    ERMSYS_EXPANSION    22L
  86. #define    ERMSYS_GADTOOLS    23L
  87. #define    ERMSYS_POWERPACKER    24L
  88. #define    ERMSYS_TRANSLATOR    25L
  89. #define    ERMSYS_DATATYPES    26L
  90. #define    ERMSYS_DISKFONT    27L
  91.  
  92. /* new for V3: */
  93. #define ERMSYS_MUI    28L
  94.  
  95. /* new for V3.04: */
  96. #define ERMSYS_XFD    29L
  97.  
  98. /* new for V4.00: */
  99. #define ERMSYS_GADTOOLSBOX    30L
  100.  
  101. /* new for V4.01: */
  102. #define ERMSYS_GUIFRONT    31L
  103. #define ERMSYS_XPK    32L
  104.  
  105. #define    ERMSYS_LAST    ERMSYS_XPK    /* (for now!) */
  106.  
  107. /************************************************************************
  108. * Subsystem ID values                            *
  109. *************************************************************************
  110. These values were chosen so that they look significant: they are equal
  111. to _LVO offsets for libraries, and CMD_ for devices... It's probably
  112. just as good to implement them as that in your program... A warning
  113. however: some _LVO are not recognized (for example, ERMSUB_MatchFirst
  114. is the same value as ERMSUB_IoErr), some are recognized as a special
  115. case (like ERMSYS_MUI/ERMSUB_MUIAutoError).
  116.  
  117. Another note: they may be ignored for some systems... */
  118. #define ERMSUB_Generic    0L    /* This is for systems that do not support
  119.     specific subsystem values. Providing this will protect you from
  120.     future changes... */
  121.  
  122. /* Values for ERMSYS_DOS: */
  123. /* Special note: passing 0 as the error code when using ERMSYS_DOS/
  124. ERMSUB_IoErr will tell errormsg.library to get the error from IoErr()
  125. itself. */
  126.  
  127. #define ERMSUB_IoErr    -132L    /* internally implemented as a cached */
  128. #define ERMSUB_MatchFirst    ERMSUB_IoErr    /* call to Fault() */
  129. #define ERMSUB_MatchNext    ERMSUB_IoErr    /* (value is _LVOIoErr) */
  130. #define ERMSUB_Fault    ERMSUB_IoErr
  131.  
  132. #define    MIN_DOS_ERROR    100    /* Only these codes are supported, */
  133. #define    MAX_DOS_ERROR    310    /* to prevent "Error code..." to be stored
  134.                    in memory hundreds of times... */
  135.  
  136. /* Values for ERMSYS_EXEC:
  137. for this value, you may pass the memory requirements (MEMF_...) as the
  138. error code for a more precise message, or 0 for a standard out of mem.
  139. ex: GetErrorMsg(ERMSYS_EXEC,ERMSUB_NoMemory,MEMF_CHIP!MEMF_CLEAR) will
  140. return "Not enough CHIP memory" */
  141. #define ERMSUB_NoMemory    -198L    /* (equals _LVOAllocMem) */
  142.  
  143. /* This value is new for V3.02. With ERMSYS_EXEC/ERMSUB_NoLibrary, you can
  144. alert the user when a library has failed to open. The Code parameter is
  145. a bit special then: it is a flag mask. By setting bits in this mask, you
  146. tell errormsg.library you wish to have a message with arguments (the library
  147. name and version) in it. See below for supported value, and for
  148. DisplayErrorMsgA() additionnal tag handling.
  149. This value can of course also be used for opening devices and resources.
  150. (You should not provide a version number for resources) */
  151. #define ERMSUB_NoLibrary    -552    /* (equals _LVOOpenLibrary) */
  152.  
  153.  
  154. /* Values for ERMSYS_GRAPHICS:
  155. note: these two are only usable as of V39 of the OS (Release 3.0) */
  156. #define ERMSUB_MakeVPort    -216L    /* (equals _LVOMakeVPort) */
  157. #define ERMSUB_MrgCop    -210L    /* (_LVOMrgCop) */
  158.  
  159. /* Values for ERMSYS_INTUITION:
  160. note: returned through the SA_ErrorCode TagItem */
  161. #define ERMSUB_OpenScreen    -198L    /* (_LVOOpenScreen) */
  162. #define ERMSUB_OpenScreenTagList    ERMSUB_OpenScreen
  163.  
  164. /* Values for ERMSYS_COMMODITIES: */
  165. #define    ERMSUB_CxBroker    -36L    /* (_LVOCxBroker) */
  166. #define    ERMSUB_CxObjError    -66L    /* (_LVOCxObjError) */
  167.  
  168. /* New for V3: this subsystem ID is valid only for ERMSYS_MUI, providing it
  169. to GetErrorMsgA() and providing a pointer to the base of muimaster.library
  170. instead of a code in D0 will tell errormsg.library to call MUI_Error
  171. automagically. This base must be valid ! errormsg.library currently checks
  172. if the ln_Name field points to the good name, but don't count on it as it
  173. can (and will if the library base is incorrect) cause (luckily harmless)
  174. Enforcer hits.
  175. If you provide the error code yourself, use ERMSUB_Generic instead.*/
  176.  
  177. #define    ERMSUB_MUIAutoError    -66L    /* (_LVOMUI_Error) */
  178.  
  179. /* New for V4.00, values defined for ERMSYS_GADTOOLSBOX: */
  180.  
  181. /* Use this one for errors returned by GTX_LoadGUIA() */
  182. #define ERMSUB_LoadGUI    -264L    /* (_LVOGTX_LoadGUIA) */
  183.  
  184. /* This one is used to identify errors returned by the function
  185. SetupScreen() in the generated source: */
  186. #define ERMSUB_SetupScreen    1L
  187.  
  188. /* And this one for errors issued by the functions OpenxxxWindow(): */
  189. #define ERMSUB_OpenAWindow    2L
  190.  
  191.  
  192. /* Values for ERMSYS_GUIFRONT, new for V4.01: */
  193.  
  194. /* This is for error codes returned by GF_CreateGUIA() via the
  195. GUI_ExtendedError tag. */
  196. #define ERMSUB_CreateGUIA    EQU    -60L    /* (_LVOGF_CreateGUIA) */
  197.  
  198.  
  199. /* No values are defined for the other systems yet, just provide
  200. ERMSUB_Generic as the subsystem code. Note: narrator.device does not
  201. use the standard error codes that are defined in exec/errors.h */
  202.  
  203. /***************************************************************************
  204. * Errors that may be returned by errormsg.library itself (returned through *
  205. * the EMT_Error tag):                                                      *
  206. ***************************************************************************/
  207. #define    ERMERR_Unsupported_System    1L
  208. #define    ERMERR_Unsupported_SubSystem    2L
  209. #define    ERMERR_Unknown_Code    3L
  210. #define    ERMERR_NoMemory    4L
  211.  
  212.  
  213. /***************************************************************************
  214. * Some flags                                                               *
  215. ***************************************************************************/
  216. /* Tell GetErrorMsgA() (and thus DisplayErrorMsgA() too) to return a message
  217. with a place (%s) for the library name when ERMSYS_EXEC/ERMSUB_NoLibrary
  218. is used (the code argument is then a mask made of these flags). */
  219. #define    EXECB_NOLIB_USENAME    0L
  220. #define    EXECF_NOLIB_USENAME    1<<EXECB_NOLIB_USENAME
  221.  
  222. /* Tell errormsg.library to return a message with a place (%ld) for the
  223. library version number when ERMSYS_EXEC/ERMSUB_NoLibrary is used. Secify
  224. only together with EXECF_NOLIB_USENAME (in the code argument too). */
  225. #define    EXECB_NOLIB_USEVERSION    1L
  226. #define    EXECF_NOLIB_USEVERSION    1<<EXECB_NOLIB_USEVERSION
  227.  
  228. /* Like it says ! */
  229. #define    EXECB_NOLIB_PRIVATE1    31L
  230. #define    EXECF_NOLIB_PRIVATE1    1<<EXECB_NOLIB_PRIVATE1
  231.  
  232.  
  233. /***************************************************************************
  234. * Tag values                                                               *
  235. ***************************************************************************/
  236. #define EMT_Dummy    TAG_USER
  237.  
  238. /* Tag values for GetErrorMsgA(): */
  239.  
  240. #define EMT_Error    EMT_Dummy+1
  241. #define EMT_Length    EMT_Dummy+2
  242. #define EMT_ForceCopy    EMT_Dummy+4
  243.  
  244. /* Tag values for DisplayMsgA(): */
  245.  
  246. #define EMT_Window    EMT_Dummy+20
  247. #define EMT_Title    EMT_Dummy+21
  248. #define EMT_GadFmt    EMT_Dummy+22
  249. #define EMT_IDCMPPtr    EMT_Dummy+23
  250.  
  251. /* new for V3.01: DisplayMessageA() (so DisplayErrorMsgA() too) can use
  252. MUI_RequestA() instead of EasyRequestArgs(). See autodocs for details. */
  253. #define    EMT_MUIBase    EMT_Dummy+24
  254. #define    EMT_MUIAppObject    EMT_Dummy+25
  255. #define    EMT_MUIWinObject    EMT_Dummy+26
  256.  
  257. /* new tags for DisplayErrorMsgA() in V3.02.
  258. these tag are only checked for ERMSYS_EXEC/ERMSUB_NoLibrary sys/subsystem
  259. pair, and only when using DisplayErrorMsgA(). If you use GetErrorMsgA()
  260. and then DisplayMessageA(), you must provide these arguments by hand. The
  261. tags are quite self-explanatory, they are described in the DisplayErrorMsgA()
  262. autodoc. */
  263. #define    EMT_LibName    EMT_Dummy+40
  264. #define    EMT_LibVersion    EMT_Dummy+41
  265.  
  266. /**************************************************************************/
  267. #define ErrorMsgName    "errormsg.library"    /* beware ! lower-case ! */
  268.  
  269. #endif    /* LIBRARIES_ERRORMSG_H */
  270.